package JAVASE521;

import java.util.Scanner;

public class phonetest {
    public static void main(String[] argc){
        //创建数组存储对象
        phone[] arr=new phone[3];
        Scanner sc=new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            phone Phone=new phone();
            //品牌
            System.out.printf("请输入第%d部手机的品牌：",i+1);
            Phone.setBrand(sc.next());
            //价格
            System.out.printf("请输入第%d部手机的价格：",i+1);
            Phone.setPrice(sc.nextInt());
            //颜色
            System.out.printf("请输入第%d部手机的颜色：",i+1);
            Phone.setColour(sc.next());
            arr[i]=Phone;
        }
        //求和
        int sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum=sum+arr[i].getPrice();
        }
        //求均值
        double average=sum/ arr.length;
        System.out.println("三部手机的平均价格是："+average);
    }

}